<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div style="width: 600px; height: 400px "></div>

    <script src="./lib/echarts.min.js"></script>
    <script>
        // 1. 初始化echarts
        // let myCharts = echarts.init(盒子)
        let myCharts = echarts.init(document.querySelector('div'))

        // 2. 创建配置项(图表最终显示成什么样,取决于配置项)
        let option = {
            title: {
                text: '小咪零食店销售表',
                left: 'center',
                textStyle: {
                    color: 'blue'
                }
            },

            xAxis: {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
                type: 'value'
            },
            legend: {
                top: 30
            },
            grid: {
                top: 40
            },
            tooltip: {
                // 触发方式(也就是什么时候提示)
                // item,默认值,表示鼠标移入每一项上才能显示
                // axis,表示鼠标移入轴线所在区域,即可提示
                trigger: 'axis'
            },
            color: ['red', 'yellow', 'pink', 'blue'],
            series: [
                {
                    data: [820, 932, 901, 934, 1290, 1330, 1320],
                    type: 'line',
                    name: '9月玩具销售'
                },
                {
                    data: [578, 965, 234, 568, 256, 876, 578],
                    type: 'line',
                    name: '9月周边销售'
                },
                {
                    data: [234, 123, 432, 324, 321, 231, 232],
                    type: 'bar',
                    name: '9月猫咪店员零食'
                },
                {
                    data: [876, 346, 632, 732, 345, 256, 754],
                    type: 'line',
                    name: '9月餐饮销售'
                }
            ]
        };
        // 3. 创建图表
        myCharts.setOption(option)
    </script>
</body>

</html>